﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.Practices.Unity;
using Repository.Repositories;
using Repository.Entities;
using Core.Interfaces;

namespace LawProject
{
    public static class IoC
    {
        private static IUnityContainer container;

        public static void Initialize()
        {
            container = new UnityContainer();
            container.RegisterType<IRepository<TBBanTin>, TBBanTinRepository>();
            container.RegisterType<IRepository<TBBanTinCon>, TBBanTinConRepository>();
            container.RegisterType<IRepository<TBLinhVuc>, TBLinhVucRepository>();
            container.RegisterType<IRepository<TBHoTro>, TBHoTroRepository>();
            container.RegisterType<IRepository<TBTinMoi>, TBTinMoiRepository>();
            container.RegisterType<IRepository<TBTTC>, TBTTCRepository>();
            container.RegisterType<IRepository<TBUser>, TBUserRepository>();
            
        }

        public static T Resolve<T>()
        {
            return container.Resolve<T>();
        }

        public static void ShutDown()
        {
            container.Dispose();
        }
    }
}